package com.naiterui.ehp.bs.recommend.controller.inner;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bp.support.exception.PublicService;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.recommend.exception.ExceptionCodes;
import com.naiterui.ehp.bs.recommend.service.IESignService;
import com.naiterui.ehp.bs.recommend.vo.esign.ywx.SignResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author guoyongxiang
 * @date 2019/12/3 17:40
 * @since 1.0.0
 */
@Api(tags = {SwaggerTag.PHARMACIST + SwaggerTag.RECOM, SwaggerTag.DOCTOR + SwaggerTag.RECOM,
        SwaggerTag.INNER_API + SwaggerTag.RECOM,})
@RequestMapping("recommend/inner")
@RestController
public class InnerEsignController {

    private static final Logger LOGGER = LoggerFactory.getLogger(InnerEsignController.class);

    @Autowired
    private IESignService ieSignService;

    @ApiOperation(value = "处方签名回调")
    @RequestMapping("esign/sign/result")
    public ResponseVO<Void> signResult(@RequestBody SignResultVO signResultVO) throws BusinessException {
        LOGGER.info("处方签名回调 signResultVO:{}", signResultVO);
        this.ieSignService.signResult(signResultVO);
        return PublicService.returnResponseVO(ExceptionCodes.SUCCESS);
    }
}
